<template>
  <basic-container :btnFlag = true>
    <div class="card-border">
      <card-header :header-data="headerData"></card-header>
      <div style="float: right;margin-right: 17px;margin-top: 16px;">
        <el-button type="primary" size="mini" @click="subjectLevyResult()">版本上传</el-button>
        <el-button type="success" size="mini" @click="opinionCollectionList()">征求意见</el-button>
      </div>
      <div class="card-body">
        <avue-crud :data="subjectListData"
                   :option="tableoption"
                   :page="page"
                   :table-loading="tableLoading"
                   @on-load="getResultList"
                   @size-change="sizeChange"
                   @current-change="currentChange"
                   class="avuecrud">
          <template slot-scope="scope" slot="menu">
            <div class="menu-title" @click.stop="opinionCollectionList(scope.row,scope.index)">
              <i class="iconfont iconview icon-primary"></i>
              <p class="menu-title-text">查看意见</p>
            </div>
            <div class="menu-title" @click.stop="fileDetail(scope.row,scope.index)">
              <i class="iconfont iconview icon-primary"></i>
              <p class="menu-title-text">详情</p>
            </div>
          </template>
        </avue-crud>
        <el-dialog title="征求意见详情" :visible.sync="fileDialogVisible" width="70%">
          <bostech-detail :detail-data="fileDetailData"></bostech-detail>
          <div slot="footer" class="dialog-footer">
            <el-button type="primary" @click="fileDialogVisible = false">确 定</el-button>
          </div>
        </el-dialog>
      </div>
    </div>
  </basic-container>
</template>

<script>
  import {getPlaitFileList} from "@/api/make";
  import {Subject_DIC} from '@/const/dict';
  import {reportHistoryrules} from '@/const/infoRules';
  import {filedownload} from "@/api/system";
  import getFileDetail from "@/mixins/file/getFileDetail";
  export default {
    name: "plaitReportHistory",
    mixins:[getFileDetail()],
    created(){
    },
    data(){
      return{
        headerData:{
          title:'版本管理'
        },
        subjectListData:[],
        fileDialogVisible:false,
        page: {
          total: 0, // 总页数
          currentPage: 1, // 当前页数
          pageSize: 10 // 每页显示多少条
        },
        tableoption: {
          page: true,
          menuWidth:240,
          addBtn: false,
          editBtn: false,
          addRowBtn: false,
          indexLabel: "序号",
          index: true,
          cellBtn: false,
  indexWidth:70,
          delBtn: false,
          columnBtn: false,
          refreshBtn: false,
          filterBtn: false,
          searchBtn:false,
          keyId: "id",
          column: [
            {
              label: "上传人",
              width: 460,
              prop: "createNickname",
              cell: true
            },
            {
              label: "最后上传时间",
              width: 180,
              prop: "lastUploadTime",
              cell: true,
            }
          ]
        },
        tableLoading:false
      }
    },
    methods:{
      // 课题征集意见跳转this.$route.params.id =subjectDeptId
      opinionCollectionList(row,index){
        let src = `/opinionCollectionList/list/${this.$route.query.achievementId}`;
        this.$router.push({
          path: src,
          query:{
            type:'3'
          }
        })
      },
      getResultList(page){
        getPlaitFileList(Object.assign({
          current: page.currentPage,
          size: page.pageSize,
          achievementId:this.$route.query.achievementId
        })).then(response => {
          this.subjectListData = response.data.data.records;
          this.page.total = response.data.data.total;
        })
      },
      // 版本上传
      subjectLevyResult(){
        let src = `/addMake/add/${this.$route.query.achievementId}`;
        this.$router.push({
          path: src
        })
      },
      fileDetail(row,index){
        this.getDetailData_file(row.makeId,'2')
        this.fileDialogVisible = true
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>
